package jsen.tool.ddd.demo.domain.parking.spec.car;

import jsen.tool.ddd.adapter.infrastructure.specification.ISpecification;
import jsen.tool.ddd.adapter.infrastructure.specification.base.SpecContext;
import jsen.tool.ddd.demo.domain.parking.Car;
import jsen.tool.ddd.demo.domain.parking.spec.loc.LocationSpec;

/**
 * @author jsen
 * @date 2021/10/6
 */
public class CarSpec implements ISpecification<Car> {
    private final ISpecification<Car> sub;

    public CarSpec() {
        sub = new CarPlateSpec().and(Car::getLocation, new LocationSpec());
    }

    @Override
    public boolean isSatisfiedBy(SpecContext<Car> t) {
        return sub.isSatisfiedBy(t);
    }
}
